//
//  YJImageDowloadProgressView.m
//  YJB
//
//  Created by YJB on 2016/11/14.
//  Copyright © 2016年 YJB. All rights reserved.
//

#import "YJImageDowloadProgressView.h"

@implementation YJImageDowloadProgressView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.roundedCorners = 2;
        self.progressLabel.font = [UIFont systemFontOfSize:11];
        self.progressLabel.textColor = APPCOLOR;

        self.trackTintColor = kUIColorFromRGB(0xcccccc);
        self.progressTintColor = APPCOLOR;
        
    }
    return self;
}

-(void)setProgress:(CGFloat)progress animated:(BOOL)animated
{
    [super setProgress:progress animated:animated];
    //%加转义字符
    NSString *text = [NSString stringWithFormat:@"%.0f%%", progress * 100];
    //解决进度条有负数的问题
    self.progressLabel.text = [text stringByReplacingOccurrencesOfString:@"-" withString:@""];
}

@end
